﻿/// <reference path="../vsdoc/jquery-1.8.3-vsdoc.js" />

/*
** Date picker settings
*/

/* CultureSettings are loaded from the cultureSettings.js:
        var defaultDateTimeFormat = "dd/mm/yy";
        var defaultCulture = "en-GB";   */
asyncHandlersForEach.push(ExtendDateTimeWithCalendar);
function ExtendDateTimeWithCalendar()
{
    $("INPUT.dateTime").each(function (e)
    {
        var format = defaultDateTimeFormat;
        var regional = $.datepicker.regional[defaultCulture || ''];
        var next = $(this).next();
        if (next && next.attr("value"))
        {
            format = next.attr("value");
        }
        if ($.datepicker.regional[defaultCulture] != null)
        {
            regional = $.datepicker.regional[defaultCulture];
        }
        if ($.datepicker.regional[defaultCulture.substring(0, 2)] != null)
        {
            regional = $.datepicker.regional[defaultCulture.substring(0, 2)];
        }
        $(this).datepicker($.extend
        ({
            dateFormat: format,
            changeMonth: true,
            changeYear: true,
            showOn: "button"
        }
        , regional
        ));

        $("BUTTON.ui-datepicker-trigger", $(this).parent()).addClass("async");
    });
}
